﻿package com.accp.crm.struts.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;
import org.apache.struts.actions.DispatchAction;

import com.accp.crm.entity.PageBean;
import com.accp.crm.service.ICstLostService;

/**
 * 客户流失 Action Bean
 * @author hailong.liu
 */
public class LostAction extends DispatchAction {
	
	 private ICstLostService lostservice;
	    
	 public void setUserService(ICstLostService lostservice){
	    this.lostservice=lostservice;
	 }
	
	/**
	 * 转到 查询页面
	 */
	public ActionForward toList(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception{
		DynaActionForm lostform=(DynaActionForm) form;
		int num=0;
		String pageNo=request.getParameter("pageNo");
		if(pageNo==null||pageNo.isEmpty()){
			num=0;
		}
		else{
			num=Integer.parseInt(pageNo);
			if(num<0){
				num=0;
			}
		}
		
		PageBean page=this.lostservice.findByStatus(num);
		request.setAttribute("lostList",page.getList());
		request.setAttribute("page", page);
		
		return mapping.findForward("list");
	}
	
}


